package com.wyf;

import com.wyf.config.IocConfig;
import com.wyf.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Starter {
    public static void main(String[] args) {
        // 基于Java配置类加载Spring的应用上下文
        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(IocConfig.class);
        // 获取指定的Bean对象
        UserService userService = annotationConfigApplicationContext.getBean(UserService.class);
        // 调用Bean对象的方法
        userService.test();
    }
}
